<?php

namespace app\admin\model\user;

use think\Model;


class Usermoney extends Model
{

    

    

    // 表名
    protected $name = 'user_money_log';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'is_clearing_text',
        'type_text',
        'postion_text'
    ];
    

    
    public function getIsClearingList()
    {
        return ['0' => __('Is_clearing 0'), '1' => __('Is_clearing 1')];
    }

    public function getTypeList()
    {
        return ['1' => __('Type 1'), '2' => __('Type 2')];
    }

    public function getPostionList()
    {
        return ['1' => __('Postion 1'), '2' => __('Postion 2'), '3' => __('Postion 3')];
    }


    public function getIsClearingTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_clearing']) ? $data['is_clearing'] : '');
        $list = $this->getIsClearingList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPostionTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['postion']) ? $data['postion'] : '');
        $list = $this->getPostionList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
